package com.qf.air.config;

import org.springframework.amqp.core.*;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @author zjw
 * @description
 * @date 2021/11/9 15:19
 */
@Configuration
public class RabbitMQConfig {

    public static final String AIR_EXCHANGE = "air_exchange";
    public static final String AIR_QUEUE = "air_queue";
    public static final String AIR_ROUTINGKEY = "air.*";

    @Bean
    public Exchange airExchange(){
        return ExchangeBuilder.topicExchange(AIR_EXCHANGE).build();
    }
    @Bean
    public Queue airQueue(){
        return QueueBuilder.durable(AIR_QUEUE).build();
    }
    @Bean
    public Binding airBinding(Exchange airExchange,Queue airQueue){
        return BindingBuilder.bind(airQueue).to(airExchange).with(AIR_ROUTINGKEY).noargs();
    }

}
